package com.wenhao.sort;

import java.util.SortedMap;

public class QuickSort {
    public static void main(String[] args) {

    }

    public static void sort (int[] array,int left,int right) {
        if (left >= right) {
            return;
        }
        int lo = left;
        int hi = right;
        int pivot = array[lo];
        while (lo < hi) {
            while (hi > lo && array[hi] > pivot) {
                hi--;
            }
            array[lo] = array[hi];
            while (lo < hi && array[lo] < pivot) {
                lo++;
            }
            array[hi] = array[lo];
        }
        sort(array,left,lo - 1);
        sort(array,lo + 1,right);
    }
}
